package com.bawei.system.remote.api;

import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.system.domain.vo.EsDocInsertVo;
import com.bawei.system.domain.vo.EsDocQueryVo;
import com.bawei.system.remote.factory.RemoteEsDocFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 全文检索服务
 *
 * @author bawei
 */
@FeignClient(contextId = "remoteEsDocService", value = ServiceNameConstants.ES_SERVICE, fallbackFactory = RemoteEsDocFallbackFactory.class)
public interface RemoteEsDocService {
    @PostMapping("/batchInsertDocs")
    public R<Boolean> batchInsertDocs(@RequestBody List<EsDocInsertVo> esDocInsertVo);


    @PostMapping("/queryDocs")
    public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo);

    @DeleteMapping("/deleteId")
    public R deleteId(@RequestParam(value = "ids") List<String> ids, @RequestParam("productInfo") String productInfo);

    //搜索自动补全
    @GetMapping("/querySuggestions/{indexName}")
    public R querySuggestions(@PathVariable(value = "indexName") String indexName,
                              @RequestParam(value = "keyWord") String keyWord,
                              @RequestParam(value = "suggesFiled") String suggesFiled);
}
